package com.example.practicespring.ConstantConfig;

import lombok.extern.slf4j.Slf4j;

import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

@Slf4j
public class ConstantConfig {
     private static final DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm");

     public static String imgPath = "/opt/javaProject/images/";

     static {
         if (System.getProperty("os.name").toLowerCase().contains("windows")) {
             imgPath = "D:\\888888\\images\\";
         }
         log.info("imgPath: {}", imgPath);
     }

     public static List<String> getTimeList() {
        List<String> timeList = new ArrayList<>();
        for (int hour = 0; hour < 24; hour++) {
            // 添加每小时的0分
            timeList.add(LocalTime.of(hour, 0).format(timeFormatter));
            // 添加每小时的30分
            timeList.add(LocalTime.of(hour, 30).format(timeFormatter));
        }
        return timeList;
    }

    // 测试方法
    public static void main(String[] args) {
        List<String> timePoints = getTimeList();
        for (String timePoint : timePoints) {
            System.out.println(timePoint);
        }
    }



}
